//package com.beeasy.hzbpm.ctrl;
//
//import cn.hutool.core.map.MapUtil;
//import cn.hutool.core.util.IdUtil;
//import com.github.llyb120.json.Obj;
//import org.beetl.sql.core.SQLReady;
//
//import java.util.List;
//
//import static com.github.llyb120.nami.ext.beetlsql.BeetlSql.sqlManager;
//import static com.github.llyb120.json.Json.o;
//
//public class support {
//
//    public Object ulist(){
//        return sqlManager.execute(new SQLReady("select true_name || '(' || username || ')' as name from t_user"), Obj.class)
//            .stream()
//            .map(e -> e.s("name"))
//            .toArray();
//    }
//
//
//    public Object login(String username){
//        List<Obj> list = sqlManager.execute(new SQLReady("select * from t_user where username = ? or true_name = ?", username, username), Obj.class);
//        if(list.isEmpty()){
//            return null;
//        }
//
//        Obj user = list.get(0);
//        String token = IdUtil.fastSimpleUUID();
//
//        sqlManager.executeUpdate(new SQLReady("insert into t_user_token(id,token,type,user_id)values(?,?,?,?)", IdUtil.createSnowflake(0L,0L).nextId(), token, "WEB", user.s("id")));
//        return o(
//            "user", MapUtil.toCamelCaseMap(user),
//            "token", token
//        );
//    }
//}
